package cn.example.office_auto_sys.modules.login.service.impl;

import cn.example.office_auto_sys.modules.login.dao.UserMapper;
import cn.example.office_auto_sys.modules.login.entity.User;
import cn.example.office_auto_sys.modules.login.entity.UserExample;
import cn.example.office_auto_sys.modules.login.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {


    @Autowired
    private UserMapper userMapper;

    @Override
    public User userLogin(String username, String password) {
        return userMapper.selectUser(username, password);
    }

    @Override
    public User checkUserName(String name) {
        return userMapper.selectName(name);
    }

    @Override
    public int registerUser(String name, String password) {
        User user = new User();
        user.setUsername(name);
        user.setPassword(password);

        return userMapper.insertSelective(user);
    }
}
